home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / ATA.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  55.4 KB  |  1,053 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        ATA.h
  3.  
  4.      Contains:    ATA (PC/AT Attachment) Interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __ATA__
  19. #define __ATA__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. /* This is the structure used for the AT Interface core routines below */
  52.  
  53. enum {
  54.     kATATrap                    = 0xAAF1,                        /* Manager trap number <This should be defined in Traps.h>*/
  55.     kATAPBVers1                    = 0x01,                            /* parameter block version number 1*/
  56.     kATAPBVers2                    = 0x02,                            /* parameter block version number for structures*/
  57.     kATAPBVers3                    = 0x03,                            /* parameter block version for ATA times*/
  58.     kATADefaultBlockSize        = 512                            /* default block size*/
  59. };
  60.  
  61. /* Used to determine the presence of traps*/
  62.  
  63. enum {
  64.     kFSMTrap                    = 0xAC,
  65.     mDQEChanged                    = 1                                /* DQE has changed */
  66. };
  67.  
  68. /* Task file definition ••• Error Register •••*/
  69.  
  70. enum {
  71.     bATABadBlock                = 7,                            /* bit number of bad block error bit*/
  72.     bATAUncorrectable            = 6,                            /* bit number of uncorrectable error bit*/
  73.     bATAMediaChanged            = 5,                            /* bit number of media changed indicator*/
  74.     bATAIDNotFound                = 4,                            /* bit number of ID not found error bit*/
  75.     bATAMediaChangeReq            = 3,                            /* bit number of media changed request*/
  76.     bATACommandAborted            = 2,                            /* bit number of command abort bit*/
  77.     bATATrack0NotFound            = 1,                            /* bit number of track not found*/
  78.     bATAAddressNotFound            = 0,                            /* bit number of address mark not found*/
  79.     mATABadBlock                = 1 << bATABadBlock,            /* Bad Block Detected*/
  80.     mATAUncorrectable            = 1 << bATAUncorrectable,        /* Uncorrectable Data Error*/
  81.     mATAMediaChanged            = 1 << bATAMediaChanged,        /* Media Changed Indicator (for removable)*/
  82.     mATAIDNotFound                = 1 << bATAIDNotFound,            /* ID Not Found*/
  83.     mATAMediaChangeReq            = 1 << bATAMediaChangeReq,        /* Media Change Requested (NOT IMPLEMENTED)*/
  84.     mATACommandAborted            = 1 << bATACommandAborted,        /* Aborted Command*/
  85.     mATATrack0NotFound            = 1 << bATATrack0NotFound,        /* Track 0 Not Found*/
  86.     mATAAddressNotFound            = 1 << bATAAddressNotFound        /* Address Mark Not Found*/
  87. };
  88.  
  89. /* Task file definition ••• Features register •••*/
  90.  
  91. enum {
  92.     bATAPIuseDMA                = 0,                            /* bit number of useDMA bit (ATAPI)*/
  93.     mATAPIuseDMA                = 1 << bATAPIuseDMA
  94. };
  95.  
  96. /* Task file definition ••• ataTFSDH Register •••*/
  97.  
  98. enum {
  99.     mATAHeadNumber                = 0x0F,                            /* Head Number (bits 0-3) */
  100.     mATASectorSize                = 0xA0,                            /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
  101.     mATADriveSelect                = 0x10,                            /* Drive (0 = master, 1 = slave) */
  102.     mATALBASelect                = 0x40                            /* LBA mode bit (0 = chs, 1 = LBA)*/
  103. };
  104.  
  105. /* Task file definition ••• Status Register •••*/
  106.  
  107. enum {
  108.     bATABusy                    = 7,                            /* bit number of BSY bit*/
  109.     bATADriveReady                = 6,                            /* bit number of drive ready bit*/
  110.     bATAWriteFault                = 5,                            /* bit number of write fault bit*/
  111.     bATASeekComplete            = 4,                            /* bit number of seek complete bit*/
  112.     bATADataRequest                = 3,                            /* bit number of data request bit*/
  113.     bATADataCorrected            = 2,                            /* bit number of data corrected bit*/
  114.     bATAIndex                    = 1,                            /* bit number of index mark*/
  115.     bATAError                    = 0,                            /* bit number of error bit*/
  116.     mATABusy                    = 1 << bATABusy,                /* Unit is busy*/
  117.     mATADriveReady                = 1 << bATADriveReady,            /* Unit is ready*/
  118.     mATAWriteFault                = 1 << bATAWriteFault,            /* Unit has a write fault condition*/
  119.     mATASeekComplete            = 1 << bATASeekComplete,        /* Unit seek complete*/
  120.     mATADataRequest                = 1 << bATADataRequest,            /* Unit data request*/
  121.     mATADataCorrected            = 1 << bATADataCorrected,        /* Data corrected*/
  122.     mATAIndex                    = 1 << bATAIndex,                /* Index mark - NOT USED*/
  123.     mATAError                    = 1 << bATAError                /* Error condition - see error register*/
  124. };
  125.  
  126. /* Task file definition ••• Device Control Register •••*/
  127.  
  128. enum {
  129.     bATADCROne                    = 3,                            /* bit number of always one bit*/
  130.     bATADCRReset                = 2,                            /* bit number of reset bit*/
  131.     bATADCRnIntEnable            = 1,                            /* bit number of interrupt disable*/
  132.     mATADCROne                    = 1 << bATADCROne,                /* always one bit*/
  133.     mATADCRReset                = 1 << bATADCRReset,            /* Reset (1 = reset)*/
  134.     mATADCRnIntEnable            = 1 << bATADCRnIntEnable        /* Interrupt Disable(0 = enabled)*/
  135. };
  136.  
  137. /* ATA Command Opcode definition*/
  138.  
  139. enum {
  140.     kATAcmdWORetry                = 0x01,                            /* Without I/O retry option*/
  141.     kATAcmdNOP                    = 0x0000,                        /* NOP operation - media detect*/
  142.     kATAcmdRecal                = 0x0010,                        /* Recalibrate command */
  143.     kATAcmdRead                    = 0x0020,                        /* Read command */
  144.     kATAcmdReadLong                = 0x0022,                        /* Read Long command*/
  145.     kATAcmdWrite                = 0x0030,                        /* Write command */
  146.     kATAcmdWriteLong            = 0x0032,                        /* Write Long*/
  147.     kATAcmdWriteVerify            = 0x003C,                        /* Write verify*/
  148.     kATAcmdReadVerify            = 0x0040,                        /* Read Verify command */
  149.     kATAcmdFormatTrack            = 0x0050,                        /* Format Track command */
  150.     kATAcmdSeek                    = 0x0070,                        /* Seek command */
  151.     kATAcmdDiagnostic            = 0x0090,                        /* Drive Diagnostic command */
  152.     kATAcmdInitDrive            = 0x0091,                        /* Init drive parameters command */
  153.     kATAcmdReadMultiple            = 0x00C4,                        /* Read multiple*/
  154.     kATAcmdWriteMultiple        = 0x00C5,                        /* Write multiple*/
  155.     kATAcmdSetRWMultiple        = 0x00C6,                        /* Set Multiple for Read/Write Multiple*/
  156.     kATAcmdReadDMA                = 0x00C8,                        /* Read DMA (with retries)*/
  157.     kATAcmdWriteDMA                = 0x00CA,                        /* Write DMA (with retries)*/
  158.     kATAcmdMCAcknowledge        = 0x00DB,                        /* Acknowledge media change - removable*/
  159.     kATAcmdDoorLock                = 0x00DE,                        /* Door lock*/
  160.     kATAcmdDoorUnlock            = 0x00DF,                        /* Door unlock*/
  161.     kATAcmdStandbyImmed            = 0x00E0,                        /* Standby Immediate*/
  162.     kATAcmdIdleImmed            = 0x00E1,                        /* Idle Immediate*/
  163.     kATAcmdStandby                = 0x00E2,                        /* Standby*/
  164.     kATAcmdIdle                    = 0x00E3,                        /* Idle*/
  165.     kATAcmdReadBuffer            = 0x00E4,                        /* Read sector buffer command */
  166.     kATAcmdCheckPowerMode        = 0x00E5,                        /* Check power mode command    <04/04/94>*/
  167.     kATAcmdSleep                = 0x00E6,                        /* Sleep*/
  168.     kATAcmdWriteBuffer            = 0x00E8,                        /* Write sector buffer command */
  169.     kATAcmdWriteSame            = 0x00E9,                        /* Write same data to multiple sectors*/
  170.     kATAcmdDriveIdentify        = 0x00EC,                        /* Identify Drive command */
  171.     kATAcmdMediaEject            = 0x00ED,                        /* Media Eject*/
  172.     kATAcmdSetFeatures            = 0x00EF                        /* Set Features*/
  173. };
  174.  
  175. /* Set feature command opcodes*/
  176.  
  177. enum {
  178.     kATAEnableWriteCache        = 0x02,                            /*        Enable write cache*/
  179.     kATASetTransferMode            = 0x03,                            /*        Set transfer mode*/
  180.     kATASetPIOMode                = 0x08,                            /*        PIO Flow Control Tx Mode bit*/
  181.     kATAEnableECC                = 0x88,                            /*        ECC enable*/
  182.     kATAEnableRetry                = 0x99,                            /*        Retry enable*/
  183.     kATAEnableReadAhead            = 0xAA                            /*        Read look-ahead enable*/
  184. };
  185.  
  186. /*
  187.   --------------------------------------------------------------------------------
  188.    enums for dealing with device IDs
  189. */
  190.  
  191.  
  192. enum {
  193.     kATABusIDMask                = 0x000000FF,
  194.     kATADeviceIDMask            = 0x0000FF00,
  195.     kATADeviceIDClippingMask    = 0x0000FFFF,
  196.     kMinBusID                    = 0x00000000,
  197.     kMaxBusID                    = 0x000000FE
  198. };
  199.  
  200.  
  201. enum {
  202.     kATAStartIterateDeviceID    = 0xFFFF,
  203.     kATAEndIterateDeviceID        = 0xFF
  204. };
  205.  
  206. /*--------------------------------------------------------------------------------*/
  207. /* Device Register Images  (8 bytes) */
  208.  
  209. struct ataTaskFile {
  210.     UInt8                             ataTFFeatures;                /* <-> Error(R) or ataTFFeatures(W) register image */
  211.     UInt8                             ataTFCount;                    /* <-> Sector count/remaining */
  212.     UInt8                             ataTFSector;                /* <-> Sector start/finish */
  213.     UInt8                             ataTFReserved;                /* reserved                    */
  214.     UInt16                             ataTFCylinder;                /* <-> ataTFCylinder (Big endian) */
  215.     UInt8                             ataTFSDH;                    /* <-> ataTFSDH register image*/
  216.     UInt8                             ataTFCommand;                /* <-> Status(R) or Command(W) register image */
  217. };
  218. typedef struct ataTaskFile                ataTaskFile;
  219. /* ATA Manager Function Code Definition*/
  220.  
  221. enum {
  222.     kATAMgrNOP                    = 0x00,                            /* No Operation*/
  223.     kATAMgrExecIO                = 0x01,                            /* Execute ATA I/O*/
  224.     kATAMgrBusInquiry            = 0x03,                            /* Bus Inquiry*/
  225.     kATAMgrQRelease                = 0x04,                            /* I/O Queue Release*/
  226.     kATAMgrAbort                = 0x10,                            /* Abort command*/
  227.     kATAMgrBusReset                = 0x11,                            /* Reset ATA bus*/
  228.     kATAMgrRegAccess            = 0x12,                            /* Register Access*/
  229.     kATAMgrDriveIdentify        = 0x13,                            /* Drive Identify            <DP03/10/94>*/
  230.     kATAMgrDriverLoad            = 0x82,                            /* Load driver from either Media, ROM, etc.*/
  231.     kATAMgrDriveRegister        = 0x85,                            /* Register a driver        <4/18/94>*/
  232.     kATAMgrFindDriverRefnum        = 0x86,                            /* lookup a driver refnum    <4/18/94>*/
  233.     kATAMgrRemoveDriverRefnum    = 0x87,                            /* De-register a driver    <4/18/94>*/
  234.     kATAMgrModifyEventMask        = 0x88,                            /* Modify driver event mask*/
  235.     kATAMgrDriveEject            = 0x89,                            /* Eject the drive        <8/1/94>*/
  236.     kATAMgrGetDrvConfiguration    = 0x8A,                            /* Get device configuration    <8/6/94>*/
  237.     kATAMgrSetDrvConfiguration    = 0x8B,                            /* Set device configuration <8/6/94>*/
  238.     kATAMgrGetLocationIcon        = 0x8C,                            /* Get card location icon    <SM4>*/
  239.     kATAMgrManagerInquiry        = 0x90,                            /* Manager Inquiry*/
  240.     kATAMgrManagerInit            = 0x91,                            /* Manager initialization*/
  241.     kATAMgrManagerShutdown        = 0x92,                            /* Manager ShutDown*/
  242.                                                                 /* note: functions 0x93 to 0x97 are reserved*/
  243.     kATAMgrFindSpecialDriverRefnum = 0x98,                        /* lookup a driver refnum; driverloader,notify-all or ROM driver.*/
  244.     kATAMgrNextAvailable        = 0x99
  245. };
  246.  
  247. /* used in the ataDrvrFlags field for kATAMgrDriveRegister,kATAMgrRemoveDriverRefnum & kATAMgrFindSpecialDriverRefnum*/
  248.  
  249. enum {
  250.     kATANotifyAllDriver            = 0,                            /* Notify-All driver*/
  251.     kATADriverLoader            = 1,                            /* Driver loader driver        */
  252.     kATAROMDriver                = 2                                /* ROM driver*/
  253. };
  254.  
  255. /* 'ATAFlags' field of the PB header definition*/
  256.  
  257. enum {
  258.     bATAFlagUseConfigSpeed        = 15,                            /* bit number of use default speed flag*/
  259.     bATAFlagByteSwap            = 14,                            /* bit number of byte swap flag*/
  260.     bATAFlagIORead                = 13,                            /* bit number of I/O read flag*/
  261.     bATAFlagIOWrite                = 12,                            /* bit number of I/O write flag*/
  262.     bATAFlagImmediate            = 11,                            /* bit number of immediate flag*/
  263.     bATAFlagQLock                = 10,                            /* bit number of que lock on error*/
  264.     bATAFlagScatterGather1        = 9,                            /* bit number of scatter gather*/
  265.     bATAFlagScatterGather0        = 8,                            /* bit numbers of scatter gather*/
  266.     bATAFlagUseDMA                = 7,                            /* bit number of use DMA flag*/
  267.     bATAFlagProtocol1            = 5,                            /* bit number of scatter gather*/
  268.     bATAFlagProtocol0            = 4,                            /* bit numbers of protocol specifier*/
  269.     bATAFlagTFRead                = 3,                            /* bit number of register update*/
  270.     bATAFlagLEDEnable            = 0,                            /* bit number of LED enable*/
  271.     mATAFlagUseConfigSpeed        = 1 << bATAFlagUseConfigSpeed,
  272.     mATAFlagByteSwap            = 1 << bATAFlagByteSwap,        /* Swap data bytes (read - after; write - before)*/
  273.     mATAFlagIORead                = 1 << bATAFlagIORead,            /* Read (in) operation*/
  274.     mATAFlagIOWrite                = 1 << bATAFlagIOWrite,            /* Write (out) operation*/
  275.     mATAFlagImmediate            = 1 << bATAFlagImmediate,        /* Head of Que; Immediate operation*/
  276.     mATAFlagQLock                = 1 << bATAFlagQLock,            /* Manager queue lock on error (freeze the queue)*/
  277.     mATAFlagScatterGather1        = 1 << bATAFlagScatterGather1,
  278.     mATAFlagScatterGather0        = 1 << bATAFlagScatterGather0,    /* Scatter gather enable*/
  279.     mATAFlagScatterGathers        = mATAFlagScatterGather1 + mATAFlagScatterGather0, /* host scatter gather type = currently type 1 supported*/
  280.     mATAFlagUseDMA                = 1 << bATAFlagUseDMA,
  281.     mATAFlagProtocol1            = 1 << bATAFlagProtocol1,        /* ATAPI protocol indicator <06/15/94>*/
  282.     mATAFlagProtocol0            = 1 << bATAFlagProtocol0,        /* PCMCIA protocol indicator <06/15/94>*/
  283.     mATAFlagProtocols            = mATAFlagProtocol1 + mATAFlagProtocol0, /* mask for protocol type field    <06/15/94>*/
  284.     mATAFlagTFRead                = 1 << bATAFlagTFRead,            /* update reg block request upon detection of an error*/
  285.     mATAFlagLEDEnable            = 1 << bATAFlagLEDEnable        /* socket LED enable*/
  286. };
  287.  
  288.  
  289.  
  290. struct ataPBHeader {
  291.                                                                 /* Start of cloned common header ataPBHdr */
  292.     struct ataPBHeader *            ataPBLink;                    /* a pointer to the next entry in the queue    */
  293.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  294.     UInt8                             ataPBVers;                    /* -->: parameter block version number*/
  295.     UInt8                             ataPBReserved;                /* Reserved                                        */
  296.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  297.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  298.     OSErr                             ataPBResult;                /* <--: Returned result                */
  299.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  300.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  301.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  302.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  303.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  304.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  305.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  306.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  307.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  308.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  309.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  310.                                                                 /* End of cloned common header ataPBHdr*/
  311. };
  312. typedef struct ataPBHeader                ataPBHeader;
  313. /* data request entry structure (16 bytes)*/
  314.  
  315. struct IOBlock {
  316.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  317.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  318. };
  319. typedef struct IOBlock                    IOBlock;
  320. /*
  321.    For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
  322.    record which exists of an array of words structured as follows…    <06/15/94>
  323. */
  324.  
  325. struct ATAPICmdPacket {
  326.     SInt16                             atapiPacketSize;            /* Size of command packet in bytes    <06/15/94>*/
  327.     SInt16                             atapiCommandByte[8];        /* The command packet itself    <06/15/94>*/
  328. };
  329. typedef struct ATAPICmdPacket            ATAPICmdPacket;
  330. /* Manager parameter block structure (96 bytes)*/
  331.  
  332. struct ataIOPB {
  333.                                                                 /* Start of cloned common header ataPBHdr*/
  334.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  335.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  336.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  337.     UInt8                             ataPBReserved;                /* Reserved                                        */
  338.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  339.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  340.     OSErr                             ataPBResult;                /* <--: Returned result                */
  341.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  342.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  343.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  344.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  345.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  346.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  347.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  348.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  349.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  350.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  351.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  352.                                                                 /* End of cloned common header ataPBHdr*/
  353.     SInt8                             ataPBStatusRegister;        /* <--: Last ATA status image*/
  354.     SInt8                             ataPBErrorRegister;            /* <--: Last ATA error image-valid if lsb of Status set*/
  355.     SInt16                             ataPBReserved5;                /* Reserved*/
  356.     UInt32                             ataPBLogicalBlockSize;        /* -->: Blind transfer size per interrupt (Logical block size)*/
  357.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  358.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  359.     UInt32                             ataPBActualTxCount;            /* <--: Actual transfer count*/
  360.     UInt32                             ataPBReserved6;                /* Reserved*/
  361.     ataTaskFile                     ataPBTaskFile;                /* <->:    Device register images*/
  362.     ATAPICmdPacket *                ataPBPacketPtr;                /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
  363.     SInt16                             ataPBReserved7[6];            /* Reserved for future expansion*/
  364. };
  365. typedef struct ataIOPB                    ataIOPB;
  366. /* Parameter block structure for bus and Manager inquiry command*/
  367. /* Manager parameter block structure*/
  368.  
  369. struct ataBusInquiry {
  370.                                                                 /* Start of cloned common header ataPBHdr*/
  371.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  372.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  373.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  374.     UInt8                             ataPBReserved;                /* Reserved                                        */
  375.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  376.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  377.     OSErr                             ataPBResult;                /* <--: Returned result                */
  378.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  379.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  380.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  381.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  382.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  383.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  384.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  385.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  386.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  387.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  388.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  389.                                                                 /* End of cloned common header ataPBHdr*/
  390.     UInt16                             ataEngineCount;                /* <--: TBD; zero for now*/
  391.     UInt16                             ataReserved1;                /* Reserved*/
  392.     UInt32                             ataDataTypes;                /* <--: TBD; zero for now*/
  393.     UInt16                             ataIOpbSize;                /* <--: Size of ATA IO PB*/
  394.     UInt16                             ataMaxIOpbSize;                /* <--: TBD; zero for now*/
  395.     UInt32                             ataFeatureFlags;            /* <--: TBD*/
  396.     UInt8                             ataVersionNum;                /* <--: Version number for the HBA*/
  397.     UInt8                             ataHBAInquiry;                /* <--: TBD; zero for now*/
  398.     UInt16                             ataReserved2;                /* Reserved*/
  399.     UInt32                             ataHBAPrivPtr;                /* <--: Ptr to HBA private data area*/
  400.     UInt32                             ataHBAPrivSize;                /* <--: Size of HBA private data area*/
  401.     UInt32                             ataAsyncFlags;                /* <--: Event capability for callback*/
  402.     UInt8                             ataPIOModes;                /* <--: PIO modes supported (bit-significant)*/
  403.     UInt8                             ataReserved3;                /* Reserved*/
  404.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported (b-sig)    */
  405.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported (b-sig)*/
  406.     UInt32                             ataReserved4[4];            /* Reserved*/
  407.     SInt8                             ataReserved5[16];            /* TBD*/
  408.     SInt8                             ataHBAVendor[16];            /* <--: Vendor ID of the HBA*/
  409.     SInt8                             ataContrlFamily[16];        /* <--: Family of ATA Controller*/
  410.     SInt8                             ataContrlType[16];            /* <--: Model number of controller*/
  411.     SInt8                             ataXPTversion[4];            /* <--: version number of XPT*/
  412.     SInt8                             ataReserved6[4];            /* Reserved*/
  413.     NumVersion                         ataHBAversion;                /* <--: version number of HBA*/
  414.     UInt8                             ataHBAslotType;                /* <--: type of slot*/
  415.     UInt8                             ataHBAslotNum;                /* <--: slot number of the HBA*/
  416.     UInt16                             ataReserved7;                /* Reserved*/
  417.     UInt32                             ataReserved8;                /* Reserved*/
  418. };
  419. typedef struct ataBusInquiry            ataBusInquiry;
  420. /* Manager parameter block structure*/
  421.  
  422. struct ataMgrInquiry {
  423.                                                                 /* Start of cloned common header ataPBHdr*/
  424.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  425.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  426.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  427.     UInt8                             ataPBReserved;                /* Reserved                                        */
  428.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  429.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  430.     OSErr                             ataPBResult;                /* <--: Returned result                */
  431.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  432.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  433.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  434.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  435.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  436.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  437.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  438.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  439.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  440.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  441.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  442.                                                                 /* End of cloned common header ataPBHdr*/
  443.     NumVersion                         ataMgrVersion;                /* Manager Version information*/
  444.     UInt8                             ataMgrPBVers;                /* <--: Manager PB version number supported*/
  445.     UInt8                             Reserved1;                    /* Reserved*/
  446.     UInt16                             ataBusCnt;                    /* <--: Number of ATA buses in the system*/
  447.     UInt16                             ataDevCnt;                    /* <--: Total number of ATA devices detected*/
  448.     UInt8                             ataPioModes;                /* <--: Maximum Programmed I/O speed mode supported*/
  449.     UInt8                             Reserved2;                    /* Reserved*/
  450.     UInt16                             ataIOClkResolution;            /* <--: IO Clock resolution in nsec (Not supported)*/
  451.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported    */
  452.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported*/
  453.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  454. };
  455. typedef struct ataMgrInquiry            ataMgrInquiry;
  456. /* Parameter block structure for Abort command*/
  457. /* Manager parameter block structure*/
  458.  
  459. struct ataAbort {
  460.                                                                 /* Start of cloned common header ataPBHdr*/
  461.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  462.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  463.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  464.     UInt8                             ataPBReserved;                /* Reserved                                        */
  465.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  466.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  467.     OSErr                             ataPBResult;                /* <--: Returned result                */
  468.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  469.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  470.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  471.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  472.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  473.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  474.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  475.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  476.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  477.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  478.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  479.                                                                 /* End of cloned common header ataPBHdr*/
  480.     ataIOPB *                        ataAbortPB;                    /* -->: Parameter block to be aborted*/
  481.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  482. };
  483. typedef struct ataAbort                    ataAbort;
  484. /* Manager parameter block structure*/
  485.  
  486. struct ATAEventRec {
  487.     UInt16                             ataEventCode;                /* --> ATA event code*/
  488.     UInt16                             ataPhysicalID;                /* --> Physical drive reference*/
  489.     SInt32                             ataDrvrContext;                /* Context pointer saved by driver*/
  490.     UInt32                             ataMarker;                    /* Always 'LOAD'*/
  491.     UInt32                             ataEventRecVersion;            /* Version number of this data structure*/
  492.     UInt32                             ataDeviceType;                /* Device type on bus (valid for load driver only)*/
  493.     UInt16                             ataRefNum;                    /* RefNum of driver (valid for remove driver only)*/
  494. };
  495. typedef struct ATAEventRec                ATAEventRec;
  496. typedef ATAEventRec *                    ATAEventRecPtr;
  497. typedef CALLBACK_API( SInt16 , ATAClientProcPtr )(ATAEventRecPtr ataERPtr);
  498. typedef STACK_UPP_TYPE(ATAClientProcPtr)                         ATAClientUPP;
  499. enum { uppATAClientProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  500. #define NewATAClientProc(userRoutine)                             (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
  501. #define CallATAClientProc(userRoutine, ataERPtr)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppATAClientProcInfo, (ataERPtr))
  502. /* Parameter block structure for Driver Register command*/
  503. /* Manager parameter block structure*/
  504.  
  505. struct ataDrvrRegister {
  506.                                                                 /* Start of cloned common header ataPBHdr*/
  507.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  508.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  509.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  510.     UInt8                             ataPBReserved;                /* Reserved                                        */
  511.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  512.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  513.     OSErr                             ataPBResult;                /* <--: Returned result                */
  514.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  515.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  516.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  517.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  518.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  519.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  520.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  521.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  522.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  523.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  524.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  525.                                                                 /* End of cloned common header ataPBHdr*/
  526.     SInt16                             ataDrvrRefNum;                /* <->: Driver reference number*/
  527.     UInt16                             ataDrvrFlags;                /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
  528.     UInt16                             ataDeviceNextID;            /* <--: used to specified the next drive ID*/
  529.     SInt16                             ataDrvrLoadPriv;            /* Driver loader private storage*/
  530.     ATAClientUPP                     ataEventHandler;            /* <->: Pointer to ATA event callback routine {PB2}*/
  531.     SInt32                             ataDrvrContext;                /* <->: Context data saved by driver {PB2}*/
  532.     SInt32                             ataEventMask;                /* <->: Set to 1 for notification of event {PB2}*/
  533.     SInt16                             Reserved[14];                /* Reserved for future expansion - from [21] {PB2}*/
  534. };
  535. typedef struct ataDrvrRegister            ataDrvrRegister;
  536. /* Parameter block structure for Modify driver event mask command*/
  537.  
  538. struct ataModifyEventMask {
  539.                                                                 /* Start of cloned common header ataPBHdr*/
  540.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  541.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  542.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  543.     UInt8                             ataPBReserved;                /* Reserved                                        */
  544.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  545.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  546.     OSErr                             ataPBResult;                /* <--: Returned result                */
  547.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  548.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  549.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  550.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  551.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  552.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  553.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  554.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  555.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  556.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  557.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  558.                                                                 /* End of cloned common header ataPBHdr*/
  559.     SInt32                             ataModifiedEventMask;        /* -->: new event mask value*/
  560.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  561. };
  562. typedef struct ataModifyEventMask        ataModifyEventMask;
  563. /* 'ataRegMask' field of the ataRegAccess definition*/
  564.  
  565. enum {
  566.     bATAAltSDevCValid            = 14,                            /* bit number of alternate status/device cntrl valid bit*/
  567.     bATAStatusCmdValid            = 7,                            /* bit number of status/command valid bit*/
  568.     bATASDHValid                = 6,                            /* bit number of ataTFSDH valid bit*/
  569.     bATACylinderHiValid            = 5,                            /* bit number of cylinder high valid bit*/
  570.     bATACylinderLoValid            = 4,                            /* bit number of cylinder low valid bit*/
  571.     bATASectorNumValid            = 3,                            /* bit number of sector number valid bit*/
  572.     bATASectorCntValid            = 2,                            /* bit number of sector count valid bit*/
  573.     bATAErrFeaturesValid        = 1,                            /* bit number of error/features valid bit*/
  574.     bATADataValid                = 0,                            /* bit number of data valid bit*/
  575.     mATAAltSDevCValid            = 1 << bATAAltSDevCValid,        /* alternate status/device control valid*/
  576.     mATAStatusCmdValid            = 1 << bATAStatusCmdValid,        /* status/command valid*/
  577.     mATASDHValid                = 1 << bATASDHValid,            /* ataTFSDH valid*/
  578.     mATACylinderHiValid            = 1 << bATACylinderHiValid,        /* cylinder high valid*/
  579.     mATACylinderLoValid            = 1 << bATACylinderLoValid,        /* cylinder low valid*/
  580.     mATASectorNumValid            = 1 << bATASectorNumValid,        /* sector number valid*/
  581.     mATASectorCntValid            = 1 << bATASectorCntValid,        /* sector count valid*/
  582.     mATAErrFeaturesValid        = 1 << bATAErrFeaturesValid,    /* error/features valid*/
  583.     mATADataValid                = 1 << bATADataValid            /* data valid*/
  584. };
  585.  
  586. /* Parameter block structure for device register access command*/
  587.  
  588. union ataRegValueUnion {
  589.     UInt8                             ataByteRegValue;            /* <->: Byte register value read or to be written*/
  590.     UInt16                             ataWordRegValue;            /* <->: Word register value read or to be written*/
  591. };
  592. typedef union ataRegValueUnion            ataRegValueUnion;
  593. /* Manager parameter block structure*/
  594.  
  595. struct ataRegAccess {
  596.                                                                 /* Start of cloned common header ataPBHdr*/
  597.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  598.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  599.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  600.     UInt8                             ataPBReserved;                /* Reserved                                        */
  601.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  602.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  603.     OSErr                             ataPBResult;                /* <--: Returned result                */
  604.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  605.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  606.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  607.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  608.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  609.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  610.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  611.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  612.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  613.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  614.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  615.                                                                 /* End of cloned common header ataPBHdr*/
  616.     UInt16                             ataRegSelect;                /* -->: Device Register Selector*/
  617.                                                                 /*            DataReg            0    */
  618.                                                                 /*            ErrorReg(R) or FeaturesReg(W)    1*/
  619.                                                                 /*            SecCntReg        2*/
  620.                                                                 /*            SecNumReg        3*/
  621.                                                                 /*            CylLoReg        4*/
  622.                                                                 /*            CylHiReg        5*/
  623.                                                                 /*            SDHReg            6*/
  624.                                                                 /*            StatusReg(R) or CmdReg(W)        7*/
  625.                                                                 /*            AltStatus(R) or DevCntr(W)    0E*/
  626.     ataRegValueUnion                 ataRegValue;
  627.                                                                 /* Following fields are valid only if ataRegSelect = 0xFFFF*/
  628.     UInt16                             ataRegMask;                    /* -->: mask for register(s) to update*/
  629.                                                                 /*        bit 0 : data register valid*/
  630.                                                                 /*        bit 1 : error/feaures register valid*/
  631.                                                                 /*        bit 2 : sector count register valid*/
  632.                                                                 /*        bit 3 : sector number register valid*/
  633.                                                                 /*        bit 4 : cylinder low register valid*/
  634.                                                                 /*        bit 5 : cylinder high register valid*/
  635.                                                                 /*        bit 6 : ataTFSDH register valid*/
  636.                                                                 /*        bit 7 : status/command register valid*/
  637.                                                                 /*        bits 8 - 13 : reserved (set to 0)*/
  638.                                                                 /*        bit 14: alternate status / device control reg valid*/
  639.                                                                 /*         bit 15: reserved (set to 0)*/
  640.     ataTaskFile                     ataRegisterImage;            /* <->: register images*/
  641.     UInt8                             ataAltSDevCReg;                /* <->: Alternate status(R) or Device Control(W) register image*/
  642.     UInt8                             Reserved3;                    /* Reserved*/
  643.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  644. };
  645. typedef struct ataRegAccess                ataRegAccess;
  646. /* Manager parameter block structure    <DP03/10/94>*/
  647.  
  648. struct ataIdentify {
  649.                                                                 /* Start of cloned common header ataPBHdr*/
  650.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  651.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  652.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  653.     UInt8                             ataPBReserved;                /* Reserved                                        */
  654.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  655.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  656.     OSErr                             ataPBResult;                /* <--: Returned result                */
  657.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  658.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  659.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  660.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  661.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  662.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  663.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  664.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  665.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  666.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  667.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  668.                                                                 /* End of cloned common header ataPBHdr*/
  669.     UInt16                             Reserved1[4];                /* Reserved.  These are used internally by the Manager*/
  670.     UInt8 *                            ataPBBuffer;                /* Buffer for the identify data (512 bytes)*/
  671.     UInt16                             Reserved2[12];                /* Used internally by the ATA Manager*/
  672.     SInt16                             Reserved3[6];                /* Reserved for future expansion*/
  673. };
  674. typedef struct ataIdentify                ataIdentify;
  675. /* 'ataConfigSetting' field of the Get/Set Device Configuration definition <8/6/94>*/
  676.  
  677. enum {
  678.     ATAPIpacketDRQ_bit            = 6,                            /* bit number of ATAPI command packet DRQ option*/
  679.     ATAPIpacketDRQ                = 1 << ATAPIpacketDRQ_bit        /* ATAPI command packet DRQ option*/
  680. };
  681.  
  682. /* atapcValid field definition*/
  683.  
  684. enum {
  685.     bATApcAccessMode            = 0,
  686.     bATApcVcc                    = 1,
  687.     bATApcVpp1                    = 2,
  688.     bATApcVpp2                    = 3,
  689.     bATApcStatus                = 4,
  690.     bATApcPin                    = 5,
  691.     bATApcCopy                    = 6,
  692.     bATApcConfigIndex            = 7,
  693.     bATApcLockUnlock            = 15,
  694.     mATApcAccessMode            = 1 << bATApcAccessMode,
  695.     mATApcVcc                    = 1 << bATApcVcc,
  696.     mATApcVpp1                    = 1 << bATApcVpp1,
  697.     mATApcVpp2                    = 1 << bATApcVpp2,
  698.     mATApcStatus                = 1 << bATApcStatus,
  699.     mATApcPin                    = 1 << bATApcPin,
  700.     mATApcCopy                    = 1 << bATApcCopy,
  701.     mATApcConfigIndex            = 1 << bATApcConfigIndex,
  702.     mATApcLockUnlock            = 1 << bATApcLockUnlock
  703. };
  704.  
  705. /* Device physical type & socket type indicator definition*/
  706.  
  707. enum {
  708.     kATADeviceUnknown            = 0x00,                            /* no device or type undetermined*/
  709.     kATADeviceATA                = 0x01,                            /* traditional ATA protocol device <7/29/94>*/
  710.     kATADeviceATAPI                = 0x02,                            /* ATAPI protocol device    <7/29/94>*/
  711.     kATADeviceReserved            = 0x03                            /* reserved by Apple (was PCMCIA)*/
  712. };
  713.  
  714.  
  715. enum {
  716.     kATASocketInternal            = 0x01,                            /* Internal ATA socket*/
  717.     kATASocketMB                = 0x02,                            /* Media Bay socket*/
  718.     kATASocketPCMCIA            = 0x03                            /* PCMCIA socket*/
  719. };
  720.  
  721. /* reserved words at the end of the devConfig structure*/
  722.  
  723. enum {
  724.     kATAConfigReserved            = 7                                /* number of reserved words at the end*/
  725. };
  726.  
  727. /*
  728.    Get/Set Device Configuration parameter block structure <8/6/94>
  729.    Manager parameter block structure
  730. */
  731.  
  732. struct ataDevConfiguration {
  733.                                                                 /* Start of cloned common header ataPBHdr*/
  734.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  735.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  736.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  737.     UInt8                             ataPBReserved;                /* Reserved                                        */
  738.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  739.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  740.     OSErr                             ataPBResult;                /* <--: Returned result                */
  741.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  742.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  743.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  744.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  745.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  746.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  747.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  748.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  749.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  750.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  751.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  752.                                                                 /* End of cloned common header ataPBHdr*/
  753.     SInt32                             ataConfigSetting;            /* <->: Configuration setting*/
  754.                                                                 /*      Bits 3 - 0: Reserved*/
  755.                                                                 /*      Bit 4: Reserved (allowLBAAccess)*/
  756.                                                                 /*      Bit 5: Reserved (allowRWMultiple)*/
  757.                                                                 /*      Bit 6: ATAPIpacketDRQ*/
  758.                                                                 /*        1 = Check for Interrupt DRQ on ATAPI command packet DRQ*/
  759.                                                                 /*        0 = Default: Check only for the assertion of command packet DRQ*/
  760.                                                                 /*      Bits 31 - 7: Reserved*/
  761.     UInt8                             ataPIOSpeedMode;            /* <->: Device access speed in PIO Mode*/
  762.     UInt8                             Reserved3;                    /* Reserved to force word alignment*/
  763.     UInt16                             atapcValid;                    /* <->: Set when pcXXX fields are valid (atapcAccessMode - atapcConfigIndex)*/
  764.                                                                 /*        bit 0 - atapcAccessMode field valid, when set*/
  765.                                                                 /*        bit 1 - atapcVcc field valid, when set*/
  766.                                                                 /*        bit 2 - atapcVpp1 field valid, when set*/
  767.                                                                 /*        bit 3 - atapcVpp2 field valid, when set*/
  768.                                                                 /*        bit 4 - atapcStatus field valid, when set*/
  769.                                                                 /*        bit 5 - atapcPin field valid, when set*/
  770.                                                                 /*        bit 6 - atapcCopy field valid, when set*/
  771.                                                                 /*        bit 7 - atapcConfigIndex field valid, when set*/
  772.                                                                 /*        bits 14-8 - Reserved*/
  773.                                                                 /*        bit 15 - device lock/unlock request (write only)*/
  774.     UInt16                             ataRWMultipleCount;            /* Reserved for future (not supported yet)*/
  775.     UInt16                             ataSectorsPerCylinder;        /* Reserved for future (not supported yet)*/
  776.     UInt16                             ataHeads;                    /* Reserved for future (not supported yet)*/
  777.     UInt16                             ataSectorsPerTrack;            /* Reserved for future (not supported yet)*/
  778.     UInt16                             ataSocketNumber;            /* <--: Socket number used by the CardServices*/
  779.                                                                 /*        0xFF = socket number invalid (Not a CardServices device)*/
  780.                                                                 /*        other = socket number of the device*/
  781.     UInt8                             ataSocketType;                /* <--: Specifies the socket type (get config only)*/
  782.                                                                 /*        00 = Unknown socket*/
  783.                                                                 /*         01 = Internal ATA bus*/
  784.                                                                 /*        02 = Media Bay*/
  785.                                                                 /*        03 = PCMCIA*/
  786.     UInt8                             ataDeviceType;                /* <--: Specifies the device type (get config only)*/
  787.                                                                 /*        00 = Unknown device*/
  788.                                                                 /*        01 = standard ATA device (HD)*/
  789.                                                                 /*        02 = ATAPI device*/
  790.                                                                 /*        03 = PCMCIA ATA device*/
  791.     UInt8                             atapcAccessMode;            /* <->: Access mode: Memory vs. I/O (PCMCIA only)*/
  792.     UInt8                             atapcVcc;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  793.     UInt8                             atapcVpp1;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  794.     UInt8                             atapcVpp2;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  795.     UInt8                             atapcStatus;                /* <->: Card Status register setting (PCMCIA only)*/
  796.     UInt8                             atapcPin;                    /* <->: Card Pin register setting (PCMCIA only)*/
  797.     UInt8                             atapcCopy;                    /* <->: Card Socket/Copy register setting (PCMCIA only)*/
  798.     UInt8                             atapcConfigIndex;            /* <->: Card Option register setting (PCMCIA only)*/
  799.     UInt8                             ataSingleDMASpeed;            /* <->: Single Word DMA Timing Class*/
  800.     UInt8                             ataMultiDMASpeed;            /* <->: Multiple Word DMA Timing Class*/
  801.     UInt16                             ataPIOCycleTime;            /* <->:Cycle time for PIO mode*/
  802.     UInt16                             ataMultiCycleTime;            /* <->:Cycle time for Multiword DMA mode*/
  803.     UInt16                             Reserved1[7];                /* Reserved for future*/
  804. };
  805. typedef struct ataDevConfiguration        ataDevConfiguration;
  806. /* Get Card Location Icon/Text    <SM4>*/
  807.  
  808. enum {
  809.     kATALargeIconHFS            = 0x0001,                        /* Large B&W icon with mask (HFS)*/
  810.     kATALargeIconProDOS            = 0x0081                        /* Large B&W icon with mask (ProDOS)*/
  811. };
  812.  
  813. /* Manager parameter block structure*/
  814.  
  815. struct ataLocationData {
  816.                                                                 /* Start of cloned common header ataPBHdr*/
  817.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  818.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  819.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  820.     UInt8                             ataPBReserved;                /* Reserved                                        */
  821.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  822.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  823.     OSErr                             ataPBResult;                /* <--: Returned result                */
  824.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  825.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  826.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  827.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  828.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  829.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  830.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  831.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  832.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  833.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  834.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  835.                                                                 /* End of cloned common header ataPBHdr*/
  836.     SInt16                             ataIconType;                /* -->: icon type specifier*/
  837.                                                                 /*         1 = Large B&W icon with mask (256 bytes)*/
  838.                                                                 /*        0x81 = Same as 1, but ProDOS icon*/
  839.     SInt16                             ataIconReserved;            /* Reserved to be longword aligned*/
  840.     SInt8 *                            ataLocationIconPtr;            /* -->: Icon Data buffer pointer*/
  841.     SInt8 *                            ataLocationStringPtr;        /* -->: Icon String buffer pointer*/
  842.     UInt16                             Reserved1[18];                /* Reserved for future*/
  843. };
  844. typedef struct ataLocationData            ataLocationData;
  845. /* ataOSType available*/
  846.  
  847. enum {
  848.     kATAddTypeMacOS                = 0x0001                        /* Blue Mac O/S ddType value*/
  849. };
  850.  
  851. /* The parameter block definition for all other ATA Manager functions.*/
  852.  
  853.  
  854. struct ataGeneric {
  855.                                                                 /* Start of cloned common header ataPBHdr*/
  856.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  857.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  858.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  859.     UInt8                             ataPBReserved;                /* Reserved                                        */
  860.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  861.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  862.     OSErr                             ataPBResult;                /* <--: Returned result                */
  863.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  864.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  865.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  866.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  867.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  868.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  869.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  870.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  871.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  872.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  873.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  874.                                                                 /* End of cloned common header ataPBHdr*/
  875.     UInt16                             Reserved[24];                /* Reserved for future*/
  876. };
  877. typedef struct ataGeneric                ataGeneric;
  878.  
  879. union ataPB {
  880.     ataIOPB                         ataIOParamBlock;            /* parameter block for I/O*/
  881.     ataBusInquiry                     ataBIParamBlock;            /* parameter block for bus inquiry*/
  882.     ataMgrInquiry                     ataMIParamBlock;            /* parameter block for Manager inquiry*/
  883.     ataAbort                         ataAbortParamBlock;            /* parameter block for abort*/
  884.     ataDrvrRegister                 ataDRParamBlock;            /* parameter block for driver register*/
  885.     ataModifyEventMask                 ataMEParamBlock;            /* parameter block for event mask modify*/
  886.     ataRegAccess                     ataRAParamBlock;            /* parameter block for register access*/
  887.     ataIdentify                     ataDIParamBlock;            /* parameter block for drive identify*/
  888.     ataDevConfiguration             ataDCParamBlock;            /* parameter block for device configuration*/
  889.     ataLocationData                 ataLDParamBlock;            /* parameter block for location icon data*/
  890.                                                                 /*ataManagerInit    ataInitParamBlock;        // parameter block for Manager initialization*/
  891.                                                                 /*ataManagerShutDn    ataSDParamBlock;        // parameter block for Manager shutdown*/
  892.                                                                 /*ataDrvrLoad        ataDLParamBlock;        // parameter block for Driver loading*/
  893.     ataGeneric                         ataGenericParamBlock;        /* parameter block for all other functions*/
  894. };
  895. typedef union ataPB                        ataPB;
  896. /* The ATA Event codes…*/
  897.  
  898. enum {
  899.     kATANullEvent                = 0x00,                            /* Just kidding -- nothing happened*/
  900.     kATAOnlineEvent                = 0x01,                            /* An ATA device has come online*/
  901.     kATAOfflineEvent            = 0x02,                            /* An ATA device has gone offline*/
  902.     kATARemovedEvent            = 0x03,                            /* An ATA device has been removed from the bus*/
  903.     kATAResetEvent                = 0x04,                            /* Someone gave a hard reset to the drive*/
  904.     kATAOfflineRequest            = 0x05,                            /* Someone requesting to offline the drive*/
  905.     kATAEjectRequest            = 0x06,                            /* Someone requesting to eject the drive*/
  906.     kATAUpdateEvent                = 0x07,                            /* Potential configuration change reported by CardServices <SM4>*/
  907.     kATATaskTimeRequest            = 0x08,                            /* The manager is requesting to be called at Task Time*/
  908.     kATALoadDriverNow            = 0x09,                            /* Load the driver for the given bus immediately*/
  909.     kATAPIResetEvent            = 0x0A,                            /* Someone gave a ATAPI reset to the drive*/
  910.                                                                 /* The following describes bit definitions in the eventMask field of ataDrvrRegister*/
  911.     bATANullEvent                = 1 << kATANullEvent,            /* null event bit*/
  912.     bATAOnlineEvent                = 1 << kATAOnlineEvent,            /* online event bit*/
  913.     bATAOfflineEvent            = 1 << kATAOfflineEvent,        /* offline event bit*/
  914.     bATARemovedEvent            = 1 << kATARemovedEvent,        /* removed event bit*/
  915.     bATAResetEvent                = 1 << kATAResetEvent,            /* ATA reset event bit*/
  916.     bATAOfflineRequest            = 1 << kATAOfflineRequest,        /* offline request event bit*/
  917.     bATAEjectRequest            = 1 << kATAEjectRequest,        /* eject request event bit*/
  918.     bATAUpdateEvent                = 1 << kATAUpdateEvent,            /* configuration update event bit*/
  919.     bATAPIResetEvent            = 1 << kATAPIResetEvent            /* ATAPI reset event bit*/
  920. };
  921.  
  922.  
  923. enum {
  924.     kATAEventMarker                = FOUR_CHAR_CODE('LOAD'),        /* Marker for the event data structure*/
  925.     kATAEventVersion1            = 0x00000001                    /* Version 1 of the event structure*/
  926. };
  927.  
  928. typedef CALLBACK_API( OSErr , ATADispatchProcPtr )(ataPB *pb);
  929. typedef STACK_UPP_TYPE(ATADispatchProcPtr)                         ATADispatchUPP;
  930. enum { uppATADispatchProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  931. #define NewATADispatchProc(userRoutine)                         (ATADispatchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATADispatchProcInfo, GetCurrentArchitecture())
  932. #define CallATADispatchProc(userRoutine, pb)                     CALL_ONE_PARAMETER_UPP((userRoutine), uppATADispatchProcInfo, (pb))
  933. EXTERN_API( SInt16 )
  934. ataManager                        (ataPB *                pb)                                    ONEWORDINLINE(0xAAF1);
  935.  
  936. /* Device Error codes: 0xDB42 - 0xDB5F    */
  937.  
  938.  
  939. enum {
  940.     ATABaseErrCode                = -9406,                        /* Base error code - 0xDB42    */
  941.     ioPending                    = 1,                            /* Asynch I/O in progress status*/
  942.     AT_NRdyErr                    = ATABaseErrCode + 0x01,        /* 0xDB43: Drive not Ready */
  943.     AT_IDNFErr                    = ATABaseErrCode + 0x02,        /* 0xDB44: ID not found */
  944.     AT_DMarkErr                    = ATABaseErrCode + 0x03,        /* 0xDB45: Data mark not found */
  945.     AT_BadBlkErr                = ATABaseErrCode + 0x04,        /* 0xDB46: Bad Block */
  946.     AT_CorDataErr                = ATABaseErrCode + 0x05,        /* 0xDB47: Data was corrected */
  947.     AT_UncDataErr                = ATABaseErrCode + 0x06,        /* 0xDB48: Data was not corrected */
  948.     AT_SeekErr                    = ATABaseErrCode + 0x07,        /* 0xDB49: Seek error */
  949.     AT_WrFltErr                    = ATABaseErrCode + 0x08,        /* 0xDB4A: Write fault */
  950.     AT_RecalErr                    = ATABaseErrCode + 0x09,        /* 0xDB4B: Recalibrate failed */
  951.     AT_AbortErr                    = ATABaseErrCode + 0x0A,        /* 0xDB4C: Command aborted by drive */
  952.     AT_MCErr                    = ATABaseErrCode + 0x0C,        /* 0xDB4E: Media Changed error*/
  953.     ATAPICheckErr                = ATABaseErrCode + 0x0D,        /* 0xDB4F: ATAPI Check condition <06/15/94>*/
  954.                                                                 /* System error codes...Custom Driver Error Codes 0xDB60 - 0xDB6F*/
  955.     DRVRCantAllocate            = ATABaseErrCode + 0x1E,        /* 0xDB60: Allocation error during initialization*/
  956.     NoATAMgr                    = ATABaseErrCode + 0x1F,        /* 0xDB61: MgrInquiry failed => No ATA Manager*/
  957.     ATAInitFail                    = ATABaseErrCode + 0x20,        /* 0xDB62: Mgr Initialization failed*/
  958.     ATABufFail                    = ATABaseErrCode + 0x21,        /* 0xDB63: Device buffer test failure*/
  959.     ATADevUnsupported            = ATABaseErrCode + 0x22,        /* 0xDB64: Device type not supported*/
  960.     ATAEjectDrvErr                = ATABaseErrCode + 0x23,        /* 0xDB65: Could not eject the drive*/
  961.                                                                 /* Manager Error Codes 0xDB70 - 0xDB8F*/
  962.     ATAMgrNotInitialized        = ATABaseErrCode + 0x2E,        /* 0xDB70: Mgr has not been initialized*/
  963.     ATAPBInvalid                = ATABaseErrCode + 0x2F,        /* 0xDB71: The bus base address couldn't be found*/
  964.     ATAFuncNotSupported            = ATABaseErrCode + 0x30,        /* 0xDB72: An unknown function code specified*/
  965.     ATABusy                        = ATABaseErrCode + 0x31,        /* 0xDB73: Selected device is busy*/
  966.     ATATransTimeOut                = ATABaseErrCode + 0x32,        /* 0xDB74: Transaction timeout detected*/
  967.     ATAReqInProg                = ATABaseErrCode + 0x33,        /* 0xDB75: Channel busy; channel is processing another cmd*/
  968.     ATAUnknownState                = ATABaseErrCode + 0x34,        /* 0xDB76: Device status register reflects an unknown state*/
  969.     ATAQLocked                    = ATABaseErrCode + 0x35,        /* 0xDB77: I/O Queue is locked due to previous I/O error.*/
  970.     ATAReqAborted                = ATABaseErrCode + 0x36,        /* 0xDB78: The I/O queue entry was aborted due to an abort req.*/
  971.                                                                 /*            or due to Manager shutdown.*/
  972.     ATAUnableToAbort            = ATABaseErrCode + 0x37,        /* 0xDB79: The I/O queue entry could not be aborted.*/
  973.     ATAAbortedDueToRst            = ATABaseErrCode + 0x38,        /* 0xDB7A: Request aborted due to a device reset command.*/
  974.     ATAPIPhaseErr                = ATABaseErrCode + 0x39,        /* 0xDB7B: Unexpected phase - •••IS THIS VALID ERROR??? <06/15/94>*/
  975.     ATAPITxCntErr                = ATABaseErrCode + 0x3A,        /* 0xDB7C: Overrun/Underrun condition detected*/
  976.     ATANoClientErr                = ATABaseErrCode + 0x3B,        /* 0xDB7D: No client present to handle the event*/
  977.     ATAInternalErr                = ATABaseErrCode + 0x3C,        /* 0xDB7E: MagnumOpus returned an error*/
  978.     ATABusErr                    = ATABaseErrCode + 0x3D,        /* 0xDB7F: Bus error detected on I/O    */
  979.     AT_NoAddrErr                = ATABaseErrCode + 0x3E,        /* 0xDB80: Invalid AT base adress */
  980.     DriverLocked                = ATABaseErrCode + 0x3F,        /* 0xDB81: Current driver must be removed before adding another*/
  981.     CantHandleEvent                = ATABaseErrCode + 0x40,        /* 0xDB82: Particular event couldn't be handled (call others)*/
  982.     ATAMgrMemoryErr                = ATABaseErrCode + 0x41,        /* 0xDB83: Manager memory allocation error    */
  983.     ATASDFailErr                = ATABaseErrCode + 0x42,        /* 0xDB84: Shutdown failure                */
  984.     ATAXferParamErr                = ATABaseErrCode + 0x43,        /* 0xDB85: I/O xfer parameters inconsistent */
  985.     ATAXferModeErr                = ATABaseErrCode + 0x44,        /* 0xDB86: I/O xfer mode not supported */
  986.     ATAMgrConsistencyErr        = ATABaseErrCode + 0x45,        /* 0XDB87: Manager detected internal inconsistency. */
  987.     ATADmaXferErr                = ATABaseErrCode + 0x46,        /* 0XDB88: fatal error in DMA side of transfer */
  988.                                                                 /* Driver loader error Codes 0xDB90 - 0xDBA5*/
  989.     ATAInvalidDrvNum            = ATABaseErrCode + 0x4E,        /* 0xDB90: Invalid drive number from event*/
  990.     ATAMemoryErr                = ATABaseErrCode + 0x4F,        /* 0xDB91: Memory allocation error*/
  991.     ATANoDDMErr                    = ATABaseErrCode + 0x50,        /* 0xDB92: No DDM found on media    */
  992.     ATANoDriverErr                = ATABaseErrCode + 0x51            /* 0xDB93: No driver found on the media    */
  993. };
  994.  
  995. /* ------------------------    Version 1 definition -------------------------------    */
  996.  
  997. enum {
  998.     v1ATABaseErrCode            = 0x0700,                        /* This needs a home somewhere*/
  999.     v1AT_NRdyErr                = 0x01 - v1ATABaseErrCode,        /* 0xF901: -0x1DBE */
  1000.     v1AT_IDNFErr                = 0x04 - v1ATABaseErrCode,        /* 0xF904: -0x1DC0 */
  1001.     v1AT_DMarkErr                = 0x05 - v1ATABaseErrCode,        /* 0xF905: -0x1DC0 */
  1002.     v1AT_BadBlkErr                = 0x06 - v1ATABaseErrCode,        /* 0xF906: -0x1DC0 */
  1003.     v1AT_CorDataErr                = 0x07 - v1ATABaseErrCode,        /* 0xF907: -0x1DC0 */
  1004.     v1AT_UncDataErr                = 0x08 - v1ATABaseErrCode,        /* 0xF908: -0x1DC0 */
  1005.     v1AT_SeekErr                = 0x09 - v1ATABaseErrCode,        /* 0xF909: -0x1DC0 */
  1006.     v1AT_WrFltErr                = 0x0A - v1ATABaseErrCode,        /* 0xF90A: -0x1DC0 */
  1007.     v1AT_RecalErr                = 0x0B - v1ATABaseErrCode,        /* 0xF90B: -0x1DC0 */
  1008.     v1AT_AbortErr                = 0x0C - v1ATABaseErrCode,        /* 0xF90C: -0x1DC0 */
  1009.     v1AT_NoAddrErr                = 0x0D - v1ATABaseErrCode,        /* 0xF90D: -0x1D8D */
  1010.     v1AT_MCErr                    = 0x0E - v1ATABaseErrCode,        /* 0xF90E: -0x1DC0*/
  1011.                                                                 /* System error codes...Custom Driver Error Codes*/
  1012.     v1DRVRCantAllocate            = -(v1ATABaseErrCode + 1),        /* 0xF8FF: -0x1D9F*/
  1013.     v1NoATAMgr                    = -(v1ATABaseErrCode + 2),        /* 0xF8FE: -0x1D9D*/
  1014.     v1ATAInitFail                = -(v1ATABaseErrCode + 3),        /* 0xF8FD: -0x1D9B*/
  1015.     v1ATABufFail                = -(v1ATABaseErrCode + 4),        /* 0xF8FC: -0x1D99*/
  1016.     v1ATADevUnsupported            = -(v1ATABaseErrCode + 5),        /* 0xF8FB: -0x1c97*/
  1017.                                                                 /* Manager Error Codes*/
  1018.     v1ATAMgrNotInitialized        = -(v1ATABaseErrCode + 10),        /* 0xF8F6: -0x1D86*/
  1019.     v1ATAPBInvalid                = -(v1ATABaseErrCode + 11),        /* 0xF8F5: -0x1D84*/
  1020.     v1ATAFuncNotSupported        = -(v1ATABaseErrCode + 12),        /* 0xF8F4: -0x1D82*/
  1021.     v1ATABusy                    = -(v1ATABaseErrCode + 13),        /* 0xF8F3: -0x1D80*/
  1022.     v1ATATransTimeOut            = -(v1ATABaseErrCode + 14),        /* 0xF8F2: -0x1D7E*/
  1023.     v1ATAReqInProg                = -(v1ATABaseErrCode + 15),        /* 0xF8F1: -0x1D7C*/
  1024.     v1ATAUnknownState            = -(v1ATABaseErrCode + 16),        /* 0xF8F0: -0x1D7A*/
  1025.     v1ATAQLocked                = -(v1ATABaseErrCode + 17),        /* 0xF8EF: -0x1D78*/
  1026.     v1ATAReqAborted                = -(v1ATABaseErrCode + 18),        /* 0xF8EE: -0x1D76*/
  1027.     v1ATAUnableToAbort            = -(v1ATABaseErrCode + 19),        /* 0xF8ED: -0x1D74*/
  1028.     v1ATAAbortedDueToRst        = -(v1ATABaseErrCode + 20)        /* 0xF8EC: -0x1D72*/
  1029. };
  1030.  
  1031.  
  1032.  
  1033. #if PRAGMA_STRUCT_ALIGN
  1034.     #pragma options align=reset
  1035. #elif PRAGMA_STRUCT_PACKPUSH
  1036.     #pragma pack(pop)
  1037. #elif PRAGMA_STRUCT_PACK
  1038.     #pragma pack()
  1039. #endif
  1040.  
  1041. #ifdef PRAGMA_IMPORT_OFF
  1042. #pragma import off
  1043. #elif PRAGMA_IMPORT
  1044. #pragma import reset
  1045. #endif
  1046.  
  1047. #ifdef __cplusplus
  1048. }
  1049. #endif
  1050.  
  1051. #endif /* __ATA__ */
  1052.  
  1053.